package com.esri.core.internal.tasks.ags.c;

import com.esri.core.geometry.SpatialReference;
import com.esri.core.tasks.query.RelatedQueryParameters;
import java.util.LinkedHashMap;
import java.util.Map;

/* loaded from: classes.dex */
public class e extends com.esri.core.internal.tasks.f {
    private static final long serialVersionUID = 1;
    protected long[] a = null;
    protected int b = -1;
    protected String[] c = null;
    double d = Double.NaN;
    SpatialReference e = null;
    protected boolean f = true;
    protected String g = null;
    boolean h = false;
    boolean i = false;
    private String j = null;

    @Override // com.esri.core.internal.tasks.f
    public boolean validate() {
        return true;
    }

    public long[] a() {
        return this.a;
    }

    public void a(long[] jArr) {
        this.a = jArr;
    }

    public int b() {
        return this.b;
    }

    public void a(int i) {
        this.b = i;
    }

    public String[] c() {
        return this.c;
    }

    public void a(String[] strArr) {
        this.c = strArr;
    }

    public double d() {
        return this.d;
    }

    public void a(double d) {
        this.d = d;
    }

    public SpatialReference e() {
        return this.e;
    }

    public void a(SpatialReference spatialReference) {
        this.e = spatialReference;
    }

    public boolean f() {
        return this.f;
    }

    public void a(boolean z) {
        this.f = z;
    }

    public String g() {
        return this.g;
    }

    public void a(String str) {
        this.g = str;
    }

    public boolean h() {
        return this.h;
    }

    public void b(boolean z) {
        this.h = z;
    }

    public boolean i() {
        return this.i;
    }

    public void c(boolean z) {
        this.i = z;
    }

    public String j() {
        return this.j;
    }

    public void b(String str) {
        this.j = str;
    }

    @Override // com.esri.core.internal.tasks.f
    public Map<String, String> generateRequestParams() throws Exception {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        long[] jArr = this.a;
        if (jArr != null && jArr.length > 0) {
            linkedHashMap.put("objectIds", com.esri.core.internal.util.a.a(jArr, ","));
        }
        String[] strArr = this.c;
        if (strArr != null && strArr.length > 0) {
            linkedHashMap.put("outFields", com.esri.core.internal.util.a.a(strArr, ","));
        }
        int i = this.b;
        if (i > -1) {
            linkedHashMap.put("relationshipId", Integer.toString(i));
        }
        linkedHashMap.put("returnGeometry", Boolean.toString(this.f));
        if (!Double.isNaN(this.d)) {
            linkedHashMap.put("maxAllowableOffset", Double.toString(this.d));
        }
        SpatialReference spatialReference = this.e;
        if (spatialReference != null) {
            linkedHashMap.put("outSR", Integer.toString(spatialReference.getID()));
        }
        String str = this.g;
        if (str != null && str.trim().length() > 0) {
            linkedHashMap.put("definitionExpression", this.g);
        }
        String str2 = this.j;
        if (str2 != null && str2.length() > 0) {
            linkedHashMap.put("gdbVersion", this.j);
        }
        return linkedHashMap;
    }

    public static e a(RelatedQueryParameters relatedQueryParameters) {
        if (relatedQueryParameters == null) {
            return null;
        }
        e eVar = new e();
        eVar.a(relatedQueryParameters.getDefintionExpression());
        eVar.b(relatedQueryParameters.getGeodatabaseVersion());
        eVar.a(relatedQueryParameters.getMaxAllowableOffset());
        eVar.a(relatedQueryParameters.getObjectIds());
        eVar.a(relatedQueryParameters.getOutFields());
        eVar.a(relatedQueryParameters.getOutSpatialReference());
        eVar.a(relatedQueryParameters.getRelationshipId());
        eVar.a(relatedQueryParameters.isReturnGeometry());
        eVar.c(relatedQueryParameters.isReturnM());
        eVar.b(relatedQueryParameters.isReturnZ());
        return eVar;
    }

    public String k() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        long[] jArr = this.a;
        if (jArr != null && jArr.length > 0) {
            sb.append(",\"objectIds\":\"" + com.esri.core.internal.util.a.a(this.a, ",") + "\"");
        }
        String[] strArr = this.c;
        if (strArr != null && strArr.length > 0) {
            sb.append(",\"outFields\":\"" + com.esri.core.internal.util.a.a(this.c, ",") + "\"");
        }
        if (this.b > -1) {
            sb.append(",\"relationshipId\":" + Integer.toString(this.b));
        }
        if (!this.f) {
            sb.append(",\"returnGeometry\":false");
        }
        String str = this.g;
        if (str != null && str.trim().length() > 0) {
            sb.append(",\"where\":\"" + this.g + "\"");
        }
        sb.append("}");
        if (sb.length() > 2) {
            sb.delete(1, 2);
        }
        return sb.toString();
    }
}
